/*
 * FileName     : theme
 * Author       : EastsunW eastsunw@foxmail.com
 * Create at    : 2022-04-22 23:09
 * Last Modified: 2022-04-23 14:59
 * Modified By  : EastsunW
 * -------------
 * Description  : 定义网站的主题设置和语言设置
 */

import { defineStore } from 'pinia';
import { useLocalStorage } from '@vueuse/core';

export const useSiteSettings = defineStore('storeUser', () => {
  const dark = useLocalStorage('dark', false)
  const language = useLocalStorage('language', 'EN')

  const changeTheme = () => {
    dark.value = !dark.value
  }

  const changeLanguage = (lang: string)=>{
    language.value = lang
  }

  return {
    dark,
    language,
    changeTheme,
    changeLanguage
  }
})
